// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ApplicationConfiguration.java

package org.quickserver.util.xmlreader;

import java.util.*;

// Referenced classes of package org.quickserver.util.xmlreader:
//            Property

public class ApplicationConfiguration extends HashMap
{

    public ApplicationConfiguration()
    {
        promptType = "gui";
    }

    public void setPromptType(String promptType)
    {
        if(promptType != null && !promptType.equals("") && (promptType.equals("gui") || promptType.equals("console")))
            this.promptType = promptType;
    }

    public String getPromptType()
    {
        return promptType;
    }

    public void addProperty(Property property)
    {
        put(property.getName(), property.getValue());
    }

    public Property findProperty(String name)
    {
        String temp = (String)get(name);
        if(temp != null)
            return new Property(name, temp);
        else
            return null;
    }

    public String toXML(String pad)
    {
        if(pad == null)
            pad = "";
        StringBuilder sb = new StringBuilder();
        sb.append(pad).append("<application-configuration>\n");
        sb.append(pad).append("\t<prompt-type>").append(getPromptType()).append("</prompt-type>");
        for(Iterator iterator = keySet().iterator(); iterator.hasNext(); sb.append(pad).append("\t</property>\n"))
        {
            String key = (String)iterator.next();
            String value = (String)get(key);
            sb.append(pad).append("\t<property>");
            sb.append(pad).append("\t\t<property-name>").append(key).append("</property-name>\n");
            sb.append(pad).append("\t\t<property-value>").append(value).append("</property-value>\n");
        }

        sb.append(pad).append("</application-configuration>\n");
        return sb.toString();
    }

    private String promptType;
}
